package GameEngine.Gui.Event;

import GameEngine.helper.PAppletBridge;

public class DefaultKeyEventListener implements IKeyEventListener {

	@Override
	public void onKeyPressed(KeyEvent e) {
		if (e.getKey() == PAppletBridge.CODED) {
			processCodedKeyCode(e.getKeyCode());
		} else {
			processKeyCode(e.getKeyCode());
		}
	}

	public void processKeyCode(int kc) {
		if (kc == KeyEvent.KC_RETURN) {
			ausgabe("Return");
		}
	}

	public void processCodedKeyCode(int kc) {
		if (kc == KeyEvent.KC_UP) {
			ausgabe("up");
		} else if (kc == KeyEvent.KC_DOWN) {
			ausgabe("down");
		}
		if (kc == KeyEvent.KC_LEFT) {
			System.out.println("left");
		} else if (kc == KeyEvent.KC_RIGHT) {
			ausgabe("right");
		}
	}

	private void ausgabe(String s) {
		System.out.println(s);
	}

}
